package miracle.joker.design.iterator;

import java.util.Iterator;
import java.util.List;

public class MovieIterator implements Iterator<Movie> {
    private List<Movie> movies;
    private int currentIndex = 0;

    public MovieIterator(List<Movie> movies) {
        this.movies = movies;
    }

    @Override
    public boolean hasNext() {
        return currentIndex < movies.size();
    }

    @Override
    public Movie next() {
        if (hasNext()) {
            return movies.get(currentIndex++);
        }
        return null;
    }
}
